package com.hs.srm.admin.modules.orders.controller;

import java.util.Map;
import java.util.Map.Entry;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import sunnykid.character.UtilCharacter;

import com.hs.srm.admin.modules.orders.service.StockService;
import com.hs.srm.admin.modules.sys.controller.AbstractController;
import com.hs.srm.common.utils.R;

/**
 * @author yanfei
 *
 * @date 2019年4月2日
 * 发货数据以及对应的二维码控制层
 */
@Controller
@RequestMapping("/scmStock")
public class ScmStockController extends AbstractController {

	private static final long serialVersionUID = -3191706206659617096L;

	@Autowired
	private StockService stockService;

	/**
	 * 根据订单号查询行项目与入库信息的混合信息
	 */
	@RequestMapping("/listStockItem")
	@ResponseBody
	public R listStockItem(@RequestParam Map<String, Object> params) {
		if(ObjectUtils.isEmpty(params.get("poNos"))){
			return R.ok();
		}
		String[] poNos = params.get("poNos").toString().split(UtilCharacter.COMMA);
		params.put("poNos", poNos);
		return R.ok(this.stockService.listStockItem(params));
	}

}
